package com.pan.entity;


import com.pan.enume.ResultEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class Result<T> implements Serializable {
    Integer code;
    String message;
    T data;


    public Result(Integer code,String message) {
        this.code = code;
        this.message = message;
    }

    public Result(ResultEnum resultEnum){
        this.code = resultEnum.getCode();
        this.message = resultEnum.getMessage();
    }

    public Result(ResultEnum resultEnum,T date){
        this.code = resultEnum.getCode();
        this.message = resultEnum.getMessage();
        this.data = date;

    }

}
